<template>
  <div>
    <el-collapse value="common">
      <el-collapse-item title="公共配置" name="common">
	      <el-form :model="specialForm" label-width="80px" size="mini" class="pad-lft-rgt-10">
		      <el-form-item label="布局方向">
			      <el-select v-model="specialForm.direction" placeholder="请选择" class="width-100">
				      <el-option label="水平方向布局" value="horizontal"></el-option>
				      <el-option label="垂直方向布局" value="vertical"></el-option>
			      </el-select>
		      </el-form-item>
		      <el-form-item v-if="specialForm.direction === 'horizontal'" label="行数">
			      <el-input-number v-model="specialForm.rows" placeholder="请设置行数" class="width-100"/>
		      </el-form-item>
		      <el-form-item v-if="specialForm.direction === 'vertical'" label="列数">
			      <el-input-number v-model="specialForm.columns" placeholder="请设置列数" class="width-100"/>
		      </el-form-item>
		      <el-form-item label="水平间距">
			      <el-input-number v-model="specialForm.gapX" placeholder="请设置水平间距" class="width-100"/>
		      </el-form-item>
		      <el-form-item label="垂直间距">
			      <el-input-number v-model="specialForm.gapY" placeholder="请设置垂直间距" class="width-100"/>
		      </el-form-item>
		      <el-form-item label="水平偏移">
			      <el-input-number v-model="specialForm.offsetX" disabled placeholder="请设置水平偏移" class="width-100"/>
		      </el-form-item>
		      <el-form-item label="垂直偏移">
			      <el-input-number v-model="specialForm.offsetY" disabled placeholder="请设置垂直偏移" class="width-100"/>
		      </el-form-item>
		      <el-form-item label="单位尺寸">
			      <el-input-number v-model="specialForm.unitSize" disabled placeholder="请设置单位尺寸" class="width-100"/>
		      </el-form-item>
		      <el-row>
			      <el-col :span="12">
				      <el-form-item label="网格颜色">
					      <PopoverColor :colorValue="specialForm.gridColor">
						      <CustomColorPicker v-model="specialForm.gridColor" show-alpha></CustomColorPicker>
					      </PopoverColor>
				      </el-form-item>
			      </el-col>
			      <el-col :span="12">
				      <el-form-item label="高亮颜色">
					      <PopoverColor :colorValue="specialForm.hoverColor">
						      <CustomColorPicker v-model="specialForm.hoverColor" show-alpha></CustomColorPicker>
					      </PopoverColor>
				      </el-form-item>
			      </el-col>
		      </el-row>
	      </el-form>
      </el-collapse-item>
    </el-collapse>
  </div>
</template>

<script>
  import {WidgetDragLayout} from "@/modules/IDE/widget/atom/widgetDragLayout";
  import CustomColorPicker from "@/components/IDE/colorPicker/Color.vue";
  import PopoverColor from "@/components/IDE/colorPicker/Popovers.vue";

  export default {
    name: 'DragLayoutSpec',
	  components: {PopoverColor, CustomColorPicker},
    props: {
      widget: {
        type: WidgetDragLayout,
        default: () => {
          return {};
        }
      }
    },
    computed: {
      specialForm() {
        return this.widget.UI.data || {};
      }
    }
  };
</script>

<style lang="less" scoped>
  .flex-com {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .label-title {
    display: inline-block;
    min-width: 56px;
    color: @colorGray10;
    font-size: 14px;
    margin-right: 5px;
  }

  .divider {
    height: 2px;
    background: #eee;
    margin: 10px 0;
  }
</style>

